/*
 Navicat Premium Dump SQL

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44)
 Source Host           : 127.0.0.1:3306
 Source Schema         : smart_community

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44)
 File Encoding         : 65001

 Date: 17/07/2025 22:27:21
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sc_user_property_company
-- ----------------------------
DROP TABLE IF EXISTS `sc_user_property_company`;
CREATE TABLE `sc_user_property_company` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联ID',
  `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  `property_company_id` bigint(20) NOT NULL COMMENT '物业公司ID',
  `position` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '职位',
  `department` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '部门',
  `employee_no` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '员工编号',
  `join_date` date DEFAULT NULL COMMENT '入职日期',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态：0-离职，1-在职，2-待入职',
  `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `version` int(11) DEFAULT '1' COMMENT 'ç‰ˆæœ¬å·',
  `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å¤‡æ³¨',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user_company` (`user_id`,`property_company_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_property_company_id` (`property_company_id`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户物业公司关联表';

-- ----------------------------
-- Records of sc_user_property_company
-- ----------------------------
BEGIN;
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (1, 11, 1, '总经理', '管理部', 'EMP001', '2024-01-01', 1, 1, '2025-06-30 06:25:06', 1, '2025-07-12 14:39:54', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (2, 9, 2, '物业经理', '物业部', 'EMP002', '2024-02-01', 1, 1, '2025-06-30 06:25:06', 1, '2025-07-12 14:40:00', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (3, 6, 2, '客服主管', '客服部', 'EMP003', '2024-03-01', 1, 1, '2025-06-30 06:25:06', 1, '2025-07-16 16:18:33', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (4, 1, 1, '管理员', '管理部', 'ADMIN001', '2024-01-01', 1, 1, '2025-06-30 15:20:50', 1, '2025-07-10 10:09:03', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (5, 7, 2, '员工', '管理部', 'EMP004', '2024-01-01', 1, 1, '2025-06-30 15:20:50', 1, '2025-07-16 16:18:29', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (6, 16, 1, '员工', '管理部', 'EMP005', '2024-01-01', 1, 1, '2025-06-30 15:20:50', 1, '2025-07-16 16:18:29', 1, NULL);
INSERT INTO `sc_user_property_company` (`id`, `user_id`, `property_company_id`, `position`, `department`, `employee_no`, `join_date`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `remark`) VALUES (7, 25, 1, '员工', '管理部', 'EMP006', '2024-01-01', 1, 1, '2025-06-30 15:20:50', 1, '2025-07-16 16:18:29', 1, NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
